package algorithm;

/**
 * User: Asuka
 * Date: 11-3-2
 * Time: 下午1:41
 */
public class Hanoi {

    private static char a = 'a', b = 'b', c = 'c';

    public static void hanoi(int sum, char a, char b, char c) {
        if (sum > 0) {
            hanoi(sum - 1, a, c, b);
            move(a, b);
            hanoi(sum - 1, c, b, a);
        }
    }

    private static void move(char a, char b) {
        System.out.println(a + "--->" + b);
    }

    public static void main(String[] args) {
        hanoi(3, a, b, c);
    }
}
